package com.air.ota.vo;

import com.air.ota.util.HexStringUtil;

//交易响应数据
public class SZTBaseResTransVO {
	
	
	protected byte ver;
	protected byte[] deviceNum;
	protected byte[] deviceSequence;
	protected String transDate;//设备交易发起时间(深圳通中心时间)
	protected byte[] sztSequence;
	
	protected byte   transResult;
	protected byte transTypeCode;
	protected byte subTransTypeCode;
	protected byte cardPhyType;
	protected byte tranAppendCode;
	
	protected byte[] transResponseData;
	
	protected byte[] mac;
	
	public SZTBaseResTransVO(){
		
		deviceNum = new byte[4];
		deviceSequence = new byte[4];
		sztSequence = new byte[4];
		mac = new byte[4];
		
	}
	
	public void parse(byte[] pkg){
		
		int transResponseDataLen = pkg.length-25-4;
		transResponseData= new byte[transResponseDataLen];
		
		byte[] tmp = new byte[7];
		
		ver = pkg[0];
		System.arraycopy(pkg, 1, deviceNum, 0, 4);
		System.arraycopy(pkg, 5, deviceSequence, 0, 4);
		
		System.arraycopy(pkg, 9, tmp, 0, 7);
		transDate = HexStringUtil.bytesToHexString(tmp);
		
		System.arraycopy(pkg, 16, sztSequence, 0, 4);
		
		this.transResult = pkg[20];
		this.transTypeCode = pkg[21];
		this.subTransTypeCode = pkg[22];
		this.cardPhyType = pkg[23];
		this.tranAppendCode = pkg[24];
		
		System.arraycopy(pkg, 25, transResponseData, 0, transResponseDataLen);
		System.arraycopy(pkg, 25+transResponseDataLen, mac, 0, 4);
		
	}

	public byte getVer() {
		return ver;
	}

	public void setVer(byte ver) {
		this.ver = ver;
	}

	public byte[] getDeviceNum() {
		return deviceNum;
	}

	public void setDeviceNum(byte[] deviceNum) {
		this.deviceNum = deviceNum;
	}

	public byte[] getDeviceSequence() {
		return deviceSequence;
	}

	public void setDeviceSequence(byte[] deviceSequence) {
		this.deviceSequence = deviceSequence;
	}

	public String getTransDate() {
		return transDate;
	}

	public void setTransDate(String transDate) {
		this.transDate = transDate;
	}

	public byte[] getSztSequence() {
		return sztSequence;
	}

	public void setSztSequence(byte[] sztSequence) {
		this.sztSequence = sztSequence;
	}

	public byte getTransResult() {
		return transResult;
	}

	public void setTransResult(byte transResult) {
		this.transResult = transResult;
	}

	public byte getTransTypeCode() {
		return transTypeCode;
	}

	public void setTransTypeCode(byte transTypeCode) {
		this.transTypeCode = transTypeCode;
	}

	public byte getSubTransTypeCode() {
		return subTransTypeCode;
	}

	public void setSubTransTypeCode(byte subTransTypeCode) {
		this.subTransTypeCode = subTransTypeCode;
	}

	public byte getCardPhyType() {
		return cardPhyType;
	}

	public void setCardPhyType(byte cardPhyType) {
		this.cardPhyType = cardPhyType;
	}

	public byte getTranAppendCode() {
		return tranAppendCode;
	}

	public void setTranAppendCode(byte tranAppendCode) {
		this.tranAppendCode = tranAppendCode;
	}

	public byte[] getTransResponseData() {
		return transResponseData;
	}

	public void setTransResponseData(byte[] transResponseData) {
		this.transResponseData = transResponseData;
	}

	public byte[] getMac() {
		return mac;
	}

	public void setMac(byte[] mac) {
		this.mac = mac;
	}
	
}
